from flask import Flask
from flask_restful import Api
from flask_migrate import Migrate
from configs.mysql import Config
from db.connection import db
from resources import TeacherList, TeacherDetail, StudentList, StudentDetail

app = Flask(__name__)
app.config.from_object(Config)

db.init_app(app)
migrate = Migrate(app, db)
api = Api(app)

api.add_resource(TeacherList, '/teachers')
api.add_resource(TeacherDetail, '/teachers/<int:teacher_id>')
api.add_resource(StudentList, '/students')
api.add_resource(StudentDetail, '/students/<int:student_id>')

if __name__ == '__main__':
    app.run(debug=True)
